<template>
    <div>
        <!-- 特检记录 -->
        <div class="container">
            <!-- 表单 -->
            <el-form :inline="true" :model="formList" class="ticketForm" id="specialRecord">
                <el-form-item label="售票时间起">
                    <el-date-picker type="date" size="mini" class="minipt" v-model="formList.startDate"
                                    value-format="yyyy-MM-dd HH:mm:ss"
                    ></el-date-picker>
                    至
                    <el-date-picker type="date" size="mini" class="minipt" v-model="formList.endDate"
                                    value-format="yyyy-MM-dd HH:mm:ss"
                    ></el-date-picker>
                </el-form-item>
                <el-form-item label="票号" class="minipt">
                    <el-input size="mini" v-model="formList.billno"></el-input>
                </el-form-item>
                <el-form-item label="条形码">
                    <el-input size="mini" v-model="formList.barcode"></el-input>
                </el-form-item>
                <button class="check-btn rf" type="button" @click="QueryList"><img
                        src="../../assets/imgs/operation_btn_icon_chaxun_default.png" alt="" class="btn-img">
                    查询
                </button>
            </el-form>
            <!-- 表格 -->
            <div>
                <el-table style="width: 100%" :data="tableData">
                    <el-table-column prop="billno" label="票号">
                    </el-table-column>
                    <el-table-column prop="barcode" label="条码"></el-table-column>
                    <el-table-column prop="bus_id_old" label="原班次"></el-table-column>
                    <el-table-column prop="seatno_old" label="原座号"></el-table-column>
                    <el-table-column prop="bus_id_new" label="检入班次"></el-table-column>
                    <el-table-column prop="seatno_new" label="检入座位"></el-table-column>
                    <el-table-column prop="oper_no" label="售票员"></el-table-column>
                    <el-table-column prop="create_time" label="操作时间"
                                     :filters="[{text: '2016-05-01', value: '2016-05-01'}, {text: '2016-05-02', value: '2016-05-02'}, {text: '2016-05-03', value: '2016-05-03'}, {text: '2016-05-04', value: '2016-05-04'}]"
                    ></el-table-column>
                </el-table>
            </div>
            <!-- 分页 -->
            <div class="pagination">
                <el-pagination
                        :page-sizes="[100, 200, 300, 400]"
                        :page-size="100"
                        layout="total, sizes, prev, pager, next, jumper"
                        :total="400">
                </el-pagination>
            </div>
        </div>
    </div>
</template>
<script>
    import qs from "qs";

    export default {
        data() {
            return {
                formList: {
                    startDate: "",
                    endDate: "",
                    billno: "",
                    barcode: "",
                },

                tableData: [],
            };
        },
        methods: {

            //查询按钮事件
            QueryList() {
                this.tableData = [];
                var that = this;
                this.$http.post(
                    "/query/tks/sp_check/list", qs.stringify({
                        filterRules: '[{"field":"tbcc.type","op":"eq","value":"特检"},' +
                            '{"field":"tbcc.create_time","op":"dge","value":"' + that.formList.startDate + '"},' +
                            '{"field":"tbcc.create_time","op":"dle","value":"' + that.formList.endDate + '"},' +
                            '{"field":"tbc.billno","op":"eq","value":"' + that.formList.billno + '"},' +
                            '{"field":"tbc.barcode","op":"eq","value":"' + that.formList.barcode + '"}]',
                        'page': '1',
                        'rows': '50',
                        'sort': 'create_time',
                        'order': 'desc',
                    })
                ).then(
                    data => {
                        for (var a of  data.data) {
                            this.tableData.push({
                                billno: a.billno,
                                barcode: a.barcode,
                                bus_id_old: a.bus_id_old,
                                seatno_old: a.seatno_old,
                                bus_id_new: a.bus_id_new,
                                seatno_new: a.seatno_new,
                                create_time: a.create_time,
                                oper_no: a.oper_no,
                            })


                        }

                    })

            }

        }
    }
</script>
<style scoped src="../../assets/css/check/specialRecord.css">
</style>
